const logger = require('../../lib/logger.lib');
const Error = require('../../lib/error.lib');
const Success = require('../../lib/success.lib');

/**
 * 抽象类
 */
class AbstractController {
    constructor() {
        this.logger = logger;
    }
    async render(ctx, view, data = {}) {
        await ctx.render(view, data);
    }
    success(data) {
        return new Success(null, data);
    }
    error(message) {
        return { error: new Error(null, message) };
    }
}

module.exports = AbstractController;